package com.zjuh.goodboy.misc;

import java.util.Date;

public abstract class DateRangeManager {
	
	public synchronized DateRange nextDateRange() {
		Date start = getStoreDate();
		Date now = new Date();
		if (start == null) {
			start = new Date(0L);
			setNextDate(now);
			return new DateRange(start, now);
		} else {
			setNextDate(now);
			return new DateRange(start, now);
		}
	}
	
	protected abstract Date getStoreDate();

	protected abstract void setNextDate(Date nextDate);
	
}
